package com.situ.web.controller;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.*;
import java.io.IOException;

@WebServlet("/setCookie")
public class Cookie1Servlet extends HttpServlet {

    @Override
    protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        Cookie cookie1 = new Cookie("goods", "IPhone");
        cookie1.setMaxAge(10 * 60);
        Cookie cookie2 = new Cookie("name", "IPhone");
        resp.addCookie(cookie1);
        resp.addCookie(cookie2);

        HttpSession session1 = req.getSession(true);
        HttpSession session2 = req.getSession();
        HttpSession session3 = req.getSession(false);
    }
}
